package com.mmall.seckill.controller;

import com.mmall.seckill.common.CodeMsg;
import com.mmall.seckill.common.Result;
import com.mmall.seckill.domain.SeckillUser;
import com.mmall.seckill.service.OrderService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by megan on 2018/7/15.
 * order controller
 */
@Controller
@RequestMapping("/order/")
public class OrderController {

    @Resource
    private OrderService orderService;

    /**
     * 订单详情
     * @param user
     * @param orderId
     * @return
     */
    @RequestMapping("detail.do")
    @ResponseBody
    public Result orderDetail(SeckillUser user,Long orderId){
        if(user != null){
            return orderService.getOrderDetail(user, orderId);
        }
        return Result.coderMsg(CodeMsg.SESSION_ERROR);
    }

}
